home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / fish / 701-725 / 718 / bootpic / bootpic_source.lz / dev_support.i < prev    next >
Text File  |  1992-08-13  |  5KB  |  186 lines

  1.  
  2.  
  3. *
  4. * rev 0.1b      Doc-Bug: c_a_d braucht d0 als parameter
  5. *
  6.  
  7.                 rsreset
  8. ln          rs.b    0
  9. ln_succ     rs.l    1
  10. ln_pred     rs.l    1
  11. ln_type     rs.b    1
  12. ln_pri      rs.b    1
  13. ln_name     rs.l    1
  14. ln_size     rs.l    0
  15.  
  16. nt_msgport  equ     4
  17. nt_message  equ     5
  18.         rsreset
  19. mp          rs.b    ln_size
  20. mp_flags    rs.b    1
  21. mp_sigbit   rs.b    1
  22. mp_sigtask  rs.l    1
  23. mp_msglist  rs.b    14
  24.         rsreset
  25. mn          rs.b    ln_size
  26. mn_replyport    rs.l    1
  27. mn_length       rs.w    1
  28. mn_size         rs.w    0
  29.         rsreset
  30.  
  31. iostdrequest    rs.l    0
  32. io_message      rs.b    mn_size
  33. io_device       rs.l    1
  34. io_unit         rs.l    1
  35. io_command      rs.w    1
  36. io_flags        rs.b    1
  37. io_error        rs.b    1
  38. io_size         rs.l    0
  39.         rsreset
  40.  
  41. td              rs.l    0
  42. td_io           rs.b    io_size
  43. tv_secs         rs.l    1
  44. tv_micro        rs.l    1
  45.  
  46.  
  47.  
  48. *****************************************************************
  49. * open_a_device öffnet Device und initialisiert Messageport     *
  50. * d0=länge des Speicherblocks                                   *
  51. * d1=devicflags                                                 *
  52. * d2=deviceunit                                                 *
  53. * a0=devicenmae                                                 *
  54. *                                                               *
  55. * d0=0 => error   else d0=pointer to iorequest                  *
  56. *****************************************************************
  57. * close_a_device schließt ein device und gibt Messageport frei  *
  58. * a1=iorequest                                                  *
  59. * d0=länge des Speicherblocks                                   *
  60. * kein Ergebnis                                                 *
  61. *****************************************************************
  62. *= Memhandling: messageport in front of iorequest_structure      =
  63. *=                                                               =
  64. *****************************************************************
  65. * createport intialisiert messageport                           *
  66. * a0=pointer to enough memory                                   *
  67. *****************************************************************
  68. * deleteport frees messageport                                  *
  69. * a0=pointer to port                                            *
  70. *****************************************************************
  71.  
  72. device_support  macro
  73.  
  74. open_a_device
  75.         movem.l d4-d7,-(sp)
  76.         move.l  a0,d4
  77.         move.l  d1,d5
  78.         move.l  d0,d6
  79.         move.l  4.w,a6
  80.         move.l  #$10000,d1
  81.         add.l   #34,d0
  82.         jsr     _lvoallocmem(a6)
  83.         move.l  d0,d7
  84.         beq     od_nomsgmem
  85.         move.l  d0,a0
  86.         moveq   #0,d0
  87.         sub.l   a1,a1
  88.         bsr     createport
  89.         tst.l   d0
  90.         beq     od_noport
  91.         add.l   #34,d7
  92.         move.l  d7,a1
  93.         move.l  a0,mn_replyport(a1)
  94.         move.w  d6,mn_length(a1)
  95.         move.b  #nt_message,ln_type(a1)
  96.         move.l  d2,d0
  97.         move.l  d4,a0
  98.         move.l  d5,d1
  99.         jsr     _lvoopendevice(a6)
  100.         tst.l   d0
  101.         beq.s   od_ok
  102.  
  103. od_error
  104.         move.l  d7,a0
  105.         sub.l   #34,d7
  106.         bsr     deleteport
  107.         add.l   #34,d7
  108.         bra.s   od_noport    ;neu !!!!!
  109. od_nomsgmem
  110.         moveq.l #0,d7    ;in q.l umgeändert
  111. od_ok
  112.         move.l  d7,d0
  113.         movem.l (sp)+,d4-7
  114.         rts
  115.  
  116. od_noport
  117.         move.l  d7,a1
  118.         sub.l   #34,a1
  119.         move.l  d6,d0
  120.         add.l   #34,d0
  121.         jsr     _lvofreemem(a6)
  122.         bra.s   od_nomsgmem
  123.  
  124. close_a_device
  125.         move.l  4.w,a6
  126.         movem.l d0/a1,-(sp)
  127.         jsr     _lvoclosedevice(a6)
  128.         movem.l (sp)+,d0/a1
  129.         move.l  mn_replyport(a1),a0
  130.         bsr     deleteport
  131.         sub.l   #34,a1
  132.         add.l   #34,d0
  133.         jsr     _lvofreemem(a6)
  134.         rts
  135.  
  136. createport
  137.         move.l  4.w,a6
  138. ;        move.b  d0,ln_pri(a0)
  139. ;        move.l  a1,ln_name(a0)
  140.         move.b  #nt_msgport,ln_type(a0)
  141.         move.l  a0,-(sp)
  142.         moveq   #$ff,d0
  143.         jsr     _lvoallocsignal(a6)
  144.         move.l  (sp),a0
  145.         move.b  d0,mp_sigbit(a0)
  146.         addq    #1,d0
  147.         beq.s   cp_error
  148.         sub.l   a1,a1
  149.         jsr     _lvofindtask(a6)
  150.         move.l  (sp)+,a0
  151.         move.l  d0,mp_sigtask(a0)
  152. ;        move.l  a0,a1
  153. ;        jsr     _lvoaddport(a6)
  154. ;        move.l  (sp)+,a0
  155.         moveq   #$ff,d0
  156.         rts
  157. cp_error
  158.         move.l   (sp)+,a0
  159.         moveq    #0,d0
  160.         rts
  161.  
  162. deleteport
  163.         movem.l d0/a1,-(sp)
  164.         move.l  4.w,a6
  165. ;        move.l  a0,-(sp)
  166. ;        move.l  a0,a1
  167. ;        jsr     _lvoremport(a6)
  168. ;        move.l  (sp)+,a0
  169.         move.b  #$ff,ln_type(a0)
  170.         moveq   #0,d0
  171.         move.b  mp_sigbit(a0),d0
  172.         jsr     _lvofreesignal(a6)
  173.         movem.l (sp)+,d0/a1
  174.         rts
  175.  
  176.         endm
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.